// 先引入经过自定义全局封装的 axios
import request from "/@/utils/request";


// 会员列表新


// 会员列表
export function tUserList(params: object) {
  return request({
    url: "/oauth/tuser/search",
    method: "POST",
    data: params,
  });
}



// 会员列表
export function userList(params: object) {
  return request({
    url: "/user/list",
    method: "POST",
    data: params,
  });
}

// 会员详情
export function userDetails(id: Number) {
  return request({
    url: `/user/info?userId=${id}`,
    method: "GET",
    data: {},
  });
}


/**
 * 会员分组
 * @param params 要传的参数值
 * @returns 返回接口数据
 */
export function tagList1(params: object) {
    return request({
      url: "/tag/list",
      method: "post",
      data: params,
    });
}

// 会员等级列表
export function levelList(params: {keyword?:any,isShow?:any}) {
  return request({
    url: `admin/system/user/level/list?name=${params.keyword}`,
    method: "get",
    data: {},
  });
}

// 会员等级新增
export function levelSave(params: Object) {
  return request({
    url: `admin/system/user/level/save`,
    method: "POST",
    data: params,
  });
}

// 会员等级编辑
export function levelUpdate(params: Object) {
  return request({
    url: `admin/system/user/level/update`,
    method: "POST",
    data: params,
  });
}

// 付费会员等级列表
export function membershipList(params: Object) {
  return request({
    url: `membership/list`,
    method: "GET",
    data: params,
  });
}


// 付费会员详情
// 文档无字段说明 供应链公司付费会员
export function membershipDetails(id: any) {
  return request({
    url: `membership/${id}`,
    method: "GET",
    data: {},
  });
}

// 付费会员新增/编辑
// 文档无字段说明 供应链公司付费会员
export function addMembership(params: Object) {
  return request({
    url: `membership/upsert`,
    method: "POST",
    data: params,
  });
}

// 付费会员等级删除
export function membershipDel(id: any) {
  return request({
    url: `membership/${id}`,
    method: "DELETE",
    data: {},
  });
}


export function memberList(params:any) {
  let paramsQuery : any = params
  paramsQuery.current = params.pageNum;
  paramsQuery.size = params.pageSize;
  return request({
    url: "user/batch/search",
    method: "post",
    data: paramsQuery,
  });
}



// 会员分组列表
export function tagList(params: object) {
  return request({
    url: "tag/list",
    method: "POST",
    data: params,
  });
}

// 新增/编辑会员分组
export function addTag(params: object) {
  return request({
    url: "tag/upsert",
    method: "POST",
    data: params,
  });
}

// 删除会员分组
export function delTag(id: any) {
  return request({
    url: `tag/${id}`,
    method: "DELETE",
    data: {},
  });
}
